home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / SCRIPT.PAK / STARTUP.SPP < prev    next >
Text File  |  1997-05-06  |  6KB  |  158 lines

  1. //----------------------------------------------------------------------------
  2. // cScript
  3. // (C) Copyright 1995, 1997 by Borland International, All Rights Reserved
  4. //
  5. // STARTUP.SPP
  6. //    Script component of cScript startup process.
  7. //
  8. // $Revision:   1.70  $
  9. //
  10. //----------------------------------------------------------------------------
  11.  
  12. //
  13. // Create an instance of the IDEApplication object called IDE.  This instance
  14. // will be used across all IDE supplied scripts to represent the IDE.
  15. // IDE is the only script variable whose existence is known internally within
  16. // the IDE.  Its prescence is required for the IDE to function properly.
  17. //
  18. export __const IDE = new IDEApplication();
  19.  
  20. // mark this module as being a library module
  21. library;
  22.  
  23. //
  24. // Show the user that we will perform some work.
  25. //
  26. IDE.StartWaitCursor();
  27.  
  28. export scriptEngine = new ScriptEngine();
  29. scriptEngine.DiagnosticMessageMask &= ~OBJECT_DIAGNOSTICS;
  30.  
  31. //
  32. // The call to initialize the ProjectManager will cause the IDE to load its initial
  33. // project file.  Most likely this will be the BCWDEF.IDE project, although a project
  34. // can be specified on the command line.  Regardless, the act of opening a project
  35. // causes any files "currently" open to be shut down and saved off to the project's
  36. // desktop file.  If you want to create your own edit buffers, do so after this has
  37. // been called.
  38. //
  39.  
  40. IDE.ProjectManagerInitialize();
  41.  
  42. //
  43. // Performs assignments based upon the request keyboard.
  44. //
  45. LoadKeyboard(){
  46.  // Process the keyboard data files and commands.
  47.  // IDEBASE.KBB Common and core keyboard assignments file name.
  48.  // For future expansion...
  49.  // declare sFileName = new String(scriptEngine.StartupDirectory + "IDEBASE.KBB");
  50.  // declare General = new KeyboardDataFile(sFileName.Text,FALSE);
  51.  
  52.  // editor.KBD Assignments based upon Options|Environment+Editor.
  53.    declare String sEmulation(IDE.KeyboardAssignmentFile);
  54.    sEmulation = sEmulation.SubString(0,sEmulation.Index(".")-1).Text + "Emulation(false);";
  55.    scriptEngine.Execute(sEmulation);
  56.  
  57.  // For future expansion...
  58.  // declare Custom  = new KeyboardDataFile("CUSTOM.KBC");
  59. }
  60.  
  61. //
  62. // Dynamically load scripts as necessary in order to optimize script engine
  63. // performance.
  64. //
  65. scriptEngine.SymbolLoad("filters", "ParseBorlandMessages, ParseGenericMessages, \
  66.                                     ParseGrepMessages, ParseHelpCompilerMessages, \
  67.                                                                         ParseResourceCompilerMessages, \
  68.                                                                         ParseFilenameMessages, ParseAssemblerMessages");
  69.  
  70. scriptEngine.SymbolLoad("mate", "LoadMateFunctionality");
  71.  
  72. scriptEngine.SymbolLoad("openfile", "LoadFileAtCursor, FindFileOnPath, \
  73.                                      SmartFileLoad");
  74.  
  75. scriptEngine.SymbolLoad("BRIEFEx", "assign_to_key, block_search, center, \
  76.                                     delete_macro, load_macro, next_char, \
  77.                                     unload_macro, prev_char, tolower, toupper, \
  78.                                     i_search, swap_anchor");
  79.  
  80. scriptEngine.SymbolLoad("ctxflopn", "ContextSensitiveFileDialog");
  81.                                     
  82. //
  83. // Script engine must have these modules loaded for a comprehensive IDE.
  84. //
  85. scriptEngine.Load("miscscr");
  86. scriptEngine.Load("edit");
  87. scriptEngine.Load("debug");
  88. scriptEngine.Load("ide");
  89. scriptEngine.Load("filtstub");
  90.  
  91. //
  92. // Process the keyboard file.
  93. //
  94. LoadKeyboard();
  95.  
  96. //
  97. // Set script diagnostic level.
  98. //
  99. scriptEngine.DiagnosticMessageMask |= OBJECT_DIAGNOSTICS;
  100.  
  101. //
  102. // Setup default view regions.
  103. //
  104. // Each of the main IDE View types has a region associated with it.  A View's 
  105. // region determines its initial position and is also used during Tile and 
  106. // Cascade operations.  The following calls determine the window characteristics 
  107. // of the IDE, namely that Editor windows shold reside in the top two thirds 
  108. // of the desktop and that the Message and Project windows occupy the lower 
  109. // third (right on top of each other).  The first argument to SetRegion 
  110. // specifies the name of the region.  The remaining arguments are dimensions 
  111. // that should be in the range 1 - 10000.  The dimensions are used at runtime 
  112. // to calculate a ratio of the IDE's desktop area to use.  Ten thousand means 
  113. // the whole thing, 5000 means half, etc.  The order of the dimension arguments 
  114. // is: left, right, top, bottom.
  115. //
  116. //IDE.SetRegion("Editor", 1, 1, 10000, 6666);  // traditional layout
  117. IDE.SetRegion("Editor", 1, 1, 7000, 6666);
  118. IDE.SetRegion("Message", 1, 6666, 10000, 10000);
  119. // IDE.SetRegion("Project", 1, 6666, 10000, 10000);  // traditional layout
  120. IDE.SetRegion("Project", 7000, 1, 10000, 6666);
  121.  
  122. IDE.SetRegion("Watches", 1, 1, 10000, 6666);
  123. IDE.SetRegion("Breakpoints", 1, 1, 10000, 6666);
  124. IDE.SetRegion("Call Stack", 1, 1, 10000, 6666);
  125. IDE.SetRegion("Processes", 1, 1, 10000, 6666);
  126. IDE.SetRegion("Inspector", 1, 1, 10000, 6666);
  127. IDE.SetRegion("Evaluator", 1, 1, 10000, 6666);
  128. IDE.SetRegion("CPU", 1, 1, 10000, 6666);
  129.  
  130. //
  131. // Provide access to the example scripts.
  132. //
  133. scriptEngine.Load("exscr");
  134.  
  135. //
  136. // Must be after EXSCR because EXSCR adds "assign_to_view_menu" to the global 
  137. // namespace
  138. //
  139. assign_to_view_menu("IDE", "&Debug|&View Locals", "debugger.Inspect(\"$locals\");", 
  140.    "inspect the variables which are owned by the currently active scope");
  141.  
  142. //
  143. // Provide access to editor tool tips
  144. //
  145. scriptEngine.Load("tips");
  146.  
  147. //
  148. // Notify IDE user of progress, set diagnostic state and regions.
  149. //
  150. print("IDE loaded in " + IDE.LoadTime + " milliseconds.");
  151. print("Startup completed.");
  152.  
  153. //
  154. // Show the user that we have completed the work.
  155. //
  156. IDE.EndWaitCursor();
  157.  
  158.